//
//  StepsCollectionViewCell.m
//  Shine
//
//  Created by 俞青武 on 16/3/11.
//  Copyright © 2016年 王斌. All rights reserved.
//

#import "StepsCollectionViewCell.h"
#import "PNChart.h"


@implementation StepsCollectionViewCell

- (id)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self createView];
    }
    return self;
}

- (void)createView{
    self.backgroundColor = COLORBLACK;
    self.averageStepsLabel = [[UILabel alloc]initWithFrame:CGRectMake(WIDTH_SCREEN *0.1, 0, WIDTH_SCREEN *0.3, WIDTH_SCREEN *0.3)];
    self.averageStepsLabel.font = [UIFont systemFontOfSize:17];
    self.averageStepsLabel.textAlignment = NSTextAlignmentCenter;
    self.averageStepsLabel.textColor = COLORWHITE;
    [self addSubview:self.averageStepsLabel];
    
    
    self.allStepsLabel = [[UILabel alloc]initWithFrame:CGRectMake(WIDTH_SCREEN *0.55, 0, WIDTH_SCREEN *0.3, WIDTH_SCREEN *0.3)];
    self.allStepsLabel.textAlignment = NSTextAlignmentCenter;
    self.allStepsLabel.font = [UIFont systemFontOfSize:17];
    self.allStepsLabel.textColor = COLORWHITE;
    [self addSubview:self.allStepsLabel];

    
    self.averageStepsNumber = [[UILabel alloc]initWithFrame:CGRectMake(WIDTH_SCREEN *0.1, WIDTH_SCREEN *0.08, WIDTH_SCREEN *0.4, WIDTH_SCREEN *0.4)];
    self.averageStepsNumber.textAlignment = NSTextAlignmentCenter;
    self.averageStepsNumber.font = [UIFont systemFontOfSize:35];
    self.averageStepsNumber.textColor = COLORYELLO;
    [self addSubview:self.averageStepsNumber];
    
    self.allStepsNumber = [[UILabel alloc]initWithFrame:CGRectMake(WIDTH_SCREEN *0.55, WIDTH_SCREEN *0.08, WIDTH_SCREEN *0.4, WIDTH_SCREEN *0.4)];
    self.allStepsNumber.textAlignment = NSTextAlignmentCenter;
    self.allStepsNumber.font = [UIFont systemFontOfSize:35];
    self.allStepsNumber.textColor = COLORYELLO;
    [self addSubview:self.allStepsNumber];
    
    PNBarChart *barChart = [[PNBarChart alloc]initWithFrame:CGRectMake(20, WIDTH_SCREEN *0.6, WIDTH_SCREEN - 40, WIDTH_SCREEN *0.8)];
    barChart.backgroundColor = [UIColor clearColor];
    barChart.chartBorderColor = [UIColor colorWithWhite:0.902 alpha:1.000];
    barChart.yChartLabelWidth = 20.0;
    barChart.chartMarginLeft = 30.0;
    barChart.chartMarginRight = 10.0;
    barChart.chartMarginTop = 5.0;
    barChart.chartMarginBottom = 10.0;
    barChart.labelMarginTop = 5.0;
    barChart.showChartBorder = YES;
    //x轴数据
    [barChart setXLabels:@[@"周一",@"周二",@"周三",@"周四",@"周五",@"周六",@"周日"]];
    //Y轴数据
    [barChart setYValues:@[@100, @100,@2000,@600,@3000,@6000,@0]];
    [barChart setStrokeColor:COLORYELLO];
    barChart.isGradientShow = NO;
    barChart.isShowNumbers = NO;
    [barChart strokeChart];
    
    //加载在视图上
    [self addSubview:barChart];
}



@end












